package cn.funeralobjects.ams.entity;

import cn.funeralobjects.ams.converter.MethodTypeConverter;
import cn.funeralobjects.ams.converter.ProtocolTypeConverter;
import cn.funeralobjects.common.annotations.Name;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.http.ProtocolType;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.*;

/**
 * entity of ProductApi
 *
 * @author FuneralObjects
 * Create date: 2020/5/28 2:08 PM
 */
@Data
@Accessors(chain = true)
@Entity
@Table(name = "t_product_api")
public class EProductApi {

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    /**
     * 名称
     */
    @Name
    private String name;
    /**
     * 执行方法
     */
    private String action;
    /**
     * 版本号
     */
    private String version;
    /**
     * 请求方式
     */
    @Convert(converter = MethodTypeConverter.class)
    private MethodType method;

    /**
     * 资源访问域
     */
    private String domain;

    /**
     * 资源访问协议
     */
    @Convert(converter = ProtocolTypeConverter.class)
    private ProtocolType protocol;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "product_id")
    private EProduct product;
}
